package com.zhongge.alloj.linkedlist;

/**
 * @ClassName Test02
 * @Description TODO
 * @Author zhongge
 * @Date 2025/9/25 8:35
 * @Version 1.0
 */
public class Test02 {
    public ListNode middleNode(ListNode head) {
        if (head == null) {
            return null;
        }
        ListNode slow = head;
        ListNode fast = head;
        while (fast!=null && fast.next != null) {
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow;
    }
}
